//
//  MoreGamesViewController.m
//  iXorsPattern
//
//  Created by Dmitry Tatarinov on 2/5/15.
//  Copyright (c) 2015 Huly-Gun Soft. All rights reserved.
//

#import "MoreGamesViewController.h"
#import <QuartzCore/QuartzCore.h>

@interface MoreGamesViewController ()

@end

@implementation MoreGamesViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
   
    UIButton *backBtn = [UIButton buttonWithType:UIButtonTypeCustom];
    [backBtn setTitle:@"Back" forState:UIControlStateNormal];
    [backBtn setFrame:CGRectMake(8, 8, 128, 48)];
    [backBtn addTarget:self action:@selector(backToMain) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:backBtn];
    
    CGFloat ofset = 20.0;
    
    UITableView *table = [[UITableView alloc] initWithFrame:CGRectMake(ofset, ofset * 3, self.view.frame.size.width - ofset * 2, self.view.frame.size.height - ofset * 4) style:UITableViewStylePlain];
    [self.view addSubview:table];
    table.delegate = self;
    table.dataSource = self;
    [table.layer setCornerRadius:10.0f];
    
    array = [[NSMutableArray alloc] initWithObjects:@"1", @"2", @"3", nil];
}

- (void)backToMain
{
   [self dismissViewControllerAnimated:false completion:nil];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return array.count;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    static NSString *CellIdentifier = @"Cell";
    
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
    if (cell == nil) {
        cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault
                                      reuseIdentifier:CellIdentifier];
    }
    
    cell.textLabel.text = [array objectAtIndex:indexPath.row];
    
    return cell;
}

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
   
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
